

<template>
  <el-menu
    :default-active="activeIndex2"
    class="el-menu-demo"
    mode="horizontal"
    @select="handleSelect"
    background-color="#545c64"
    text-color="#fff"
    active-text-color="#ffd04b">
    <el-submenu index="1">
      <template slot="title">首页</template>
      <el-menu-item index="1-1" @click="$router.push('/home/notice')" >通知</el-menu-item>
      <el-menu-item index="1-2" @click="$router.push('/home/selectiontopic')" >在线选题</el-menu-item>
      <el-menu-item index="1-3" @click="$router.push('/home/filedownload')">文件下载</el-menu-item>
    </el-submenu>
    <el-submenu index="2">
      <template slot="title">个人中心</template>
      <el-menu-item index="2-1">修改个人信息</el-menu-item>
      <el-menu-item index="2-2">消息</el-menu-item>
      <el-menu-item index="2-3"  @click="handleLogout">退出登录</el-menu-item>
    </el-submenu>
    <el-menu-item index="3" @click="$router.push('/home/gtss')">毕业设计（论文）</el-menu-item>
    <el-submenu index="4">
      <template slot="title">后台管理</template>
      <el-menu-item index="4-1" @click="$router.push('/home/topicreview')">
        教师审核学生意向选题
      </el-menu-item>
      <el-menu-item index="4-2" @click="$router.push('/home/gtssreview')">
        毕设进度审核
      </el-menu-item>
    </el-submenu>
  </el-menu>


</template>


<script>
export default {
  data() {
    return {
      activeIndex: '1',
      activeIndex2: '1'
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    handleLogout() {
      this.$confirm('确认退出登录吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // 清除本地存储
        localStorage.removeItem('token');
        localStorage.removeItem('userid');
        localStorage.removeItem('role');
        localStorage.removeItem('username');
        // 跳转到登录页
        this.$router.push('/login');
      }).catch(() => {});
    }
  },

}
</script>
